from __future__ import annotations

from datetime import date, datetime
from typing import Optional

from pydantic import EmailStr, Field

from app.schemas.common import APIModel, Timestamped


class PartnerProfile(APIModel):
  partner_name: Optional[str] = None
  relationship_start_date: Optional[date] = None
  timezone: Optional[str] = None
  notification_prefs: Optional[dict] = None


class UserBase(APIModel):
  email: EmailStr
  username: str
  is_active: bool = True
  nickname: Optional[str] = None


class UserDetail(UserBase, Timestamped):
  id: int
  verified_at: Optional[datetime] = None
  prefs: Optional[dict] = None
  active_relationship_id: Optional[int] = None
  partner_profile: Optional[PartnerProfile] = None


class UpdatePreferencesRequest(APIModel):
  prefs: dict


class UpdateProfileRequest(APIModel):
  username: Optional[str] = None
  nickname: Optional[str] = None
  partner_profile: Optional[PartnerProfile] = None

